package com.own.component.elastic.constant;

import co.elastic.clients.elasticsearch._types.mapping.Property;
import co.elastic.clients.elasticsearch._types.mapping.TextProperty;
import co.elastic.clients.util.ObjectBuilder;

import java.util.UUID;
import java.util.function.Function;

/**
 * ElasticSearchCommonConstant
 *
 * @author chenxueli
 * @date 2024-03-11 13:22:00
 */
public class ElasticSearchCommonConstant {

    /**
     * 默认统计字段名称
     */
    public static final String AGGREGATION_DEFAULT_NAME = UUID.randomUUID().toString().replace("-", "").substring(0, 5);

    /**
     * 默认处理器
     */
    public static final Function<Property.Builder, ObjectBuilder<Property>> DEFAULT_HANDLER = property -> property.text(TextProperty.of(text -> text.index(true)));

}
